﻿using DocumentFormat.OpenXml.Lite.DrawingML.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Style
{
    [XmlRoot("cont", Namespace = Constants.Main)]
    public class Container : XmlSerializable, IBlipElement, IContainerElement
    {
        [XmlElement("", Namespace = Constants.Main)]
        public XmlList<IContainerElement> Elements { get; set; }

        public Container()
        {
            Elements = new XmlList<IContainerElement>();
        }
    }

    [XmlRoot("effect", Namespace = Constants.Main)]
    public class Effect : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("ref", Form = XmlSchemaForm.Qualified)]
        public string Reference { get; set; }

        public Effect() { }
    }

    [XmlRoot("alphaOutset", Namespace = Constants.Main)]
    public class AlphaOutset : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("rad", Form = XmlSchemaForm.Qualified)]
        public Nullable<long> Radius { get; set; }

        public AlphaOutset() { }
    }

    [XmlRoot("blend", Namespace = Constants.Main)]
    public class Blend : XmlSerializable, IContainerElement
    {
        [XmlAttribute("rad", Form = XmlSchemaForm.Qualified)]
        public ST_BlendMode Radius { get; set; }

        [Optional]
        [XmlElement("cont", Namespace = Constants.Main)]
        public Container Container { get; set; }

        public Blend() { }
    }

    [XmlRoot("fill", Namespace = Constants.Main)]
    public class Fill : XmlSerializable, IContainerElement
    {
        [XmlElement("", Namespace = Constants.Main)]
        public IFillProperty Container { get; set; }

        public Fill() { }
    }

    [XmlRoot("glow", Namespace = Constants.Main)]
    public class Glow : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("rad", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Radius { get; set; }

        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public Glow() { }
    }

    [XmlRoot("innerShdw", Namespace = Constants.Main)]
    public class InnerShadow : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("blurRad", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> BlurRadius { get; set; }

        [Optional]
        [XmlAttribute("dist", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Distance { get; set; }

        [Optional]
        [XmlAttribute("dir", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Direction { get; set; }

        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public InnerShadow() { }
    }

    [XmlRoot("outerShdw", Namespace = Constants.Main)]
    public class OuterShadow : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("blurRad", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> BlurRadius { get; set; }

        [Optional]
        [XmlAttribute("dist", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Distance { get; set; }

        [Optional]
        [XmlAttribute("dir", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Direction { get; set; }

        [Optional]
        [XmlAttribute("sx", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> HorizontalScalingFactor { get; set; }

        [Optional]
        [XmlAttribute("xy", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> VerticalScalingFactor { get; set; }

        [Optional]
        [XmlAttribute("kx", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> HorizontalSkew { get; set; }
        [Optional]
        [XmlAttribute("ky", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> VerticalSkew { get; set; }

        [Optional]
        [XmlAttribute("algn", Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_RectAlignment> Alignment { get; set; }

        [Optional]
        [XmlAttribute("rotWithShape", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> RotateWithShape { get; set; }

        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public OuterShadow() { }
    }

    [XmlRoot("prstShdw", Namespace = Constants.Main)]
    public class PresetShadow : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("prst", Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_PresetShadowVal> Value { get; set; }

        [Optional]
        [XmlAttribute("dist", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Distance { get; set; }

        [Optional]
        [XmlAttribute("dir", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Direction { get; set; }

        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public PresetShadow() { }
    }

    [XmlRoot("relOff", Namespace = Constants.Main)]
    public class RelativeOffset : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("tx", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> OffsetX { get; set; }

        [Optional]
        [XmlAttribute("ty", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> OffsetY { get; set; }

        public RelativeOffset() { }
    }

    [XmlRoot("softEdge", Namespace = Constants.Main)]
    public class SoftEdge : XmlSerializable, IContainerElement
    {
        [XmlAttribute("rad", Form = XmlSchemaForm.Qualified)]
        public Nullable<long> Radius { get; set; }

        public SoftEdge() { }
    }

    [XmlRoot("xfrm", Namespace = Constants.Main)]
    public class Transform : XmlSerializable, IContainerElement
    {
        [Optional]
        [XmlAttribute("sx", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> HorizontalRatio { get; set; }

        [Optional]
        [XmlAttribute("sy", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> VerticalRatio { get; set; }

        [Optional]
        [XmlAttribute("kx", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> HorizontalSkew { get; set; }

        [Optional]
        [XmlAttribute("ky", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> VerticalSkew { get; set; }

        [Optional]
        [XmlAttribute("tx", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> HorizontalShift { get; set; }

        [Optional]
        [XmlAttribute("ty", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> VerticalShift { get; set; }

        public Transform() { }
    }
}
